#pragma once
#include"HashTable.h"

namespace bit1
{
	template<class K>
	class unordered_set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};

	public:
		typedef typename hash_bucket::HashTable<K, K, SetKeyOfT>::Iterator iterator;

		bool insert(const K& key)
		{
			return _ht.Insert(key);
		}
		iterator begin()
		{
			return _ht.Begin();
		}
		iterator end()
		{
			return _ht.End();
		}
	private:
		hash_bucket::HashTable<K, K, SetKeyOfT> _ht;
	};

	void test_set()
	{
		unordered_set<int> s;
		int a[] = { 4,2,6,1,3,5,15,7,16,14 };
		for (auto e : a)
		{
			s.insert(e);
		}
		unordered_set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			//*it += 1;

			cout << *it << " ";
			++it;
		}
		cout << endl;
	}
}